<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateBannersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('banners', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('customer_id')->default(0)->comment('关联customers表的id');
			$table->integer('banner_type_id')->unsigned()->default(0)->comment('跳转类型ID');
			$table->string('name')->nullable()->comment('banner 名称');
			$table->string('image', 300)->comment('图片Key');
			$table->text('data', 65535)->nullable()->comment('跳转的对应的数据JSON');
			$table->integer('priority')->default(0)->comment('排序');
			$table->dateTime('started_at')->default('1970-01-02 00:00:00')->comment('广告（banner）开始时间');
			$table->dateTime('ended_at')->default('2038-01-02 00:00:00')->comment('广告（banner）结束时间');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('banners');
	}

}
